<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div>111</div>
  <div class="box">222</div>
  <div>333</div>
  <p>444</p>
  <div class="box">555</div>

  <script>
    // 1. 只能获取一个
    const myDiv = document.querySelector('div')
    console.log(myDiv);


    // 2. 获取全部数据
    const myDivS = document.querySelector('div')
    console.log(myDivS);


    // 3. 按需获取全部数据
    const myDivSS = document.querySelector('.box')
    console.log(myDivSS);
  </script>
</body>

</html>